package com._520it.wms.web.controller;

import com._520it.wms.query.ProductStockQueryObject;
import com._520it.wms.service.IBrandService;
import com._520it.wms.service.IDepotService;
import com._520it.wms.service.IProductStockService;
import com._520it.wms.util.RequiredPermission;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * Created by HASEE on 2017/11/14.
 */
@Controller
@RequestMapping("/productStock")
public class ProductStockContorller {
    @Autowired
    private IProductStockService productStockService;
    @Autowired
    private IBrandService brandService;
    @Autowired
    private IDepotService depotService;

    @RequestMapping("/list")
    @RequiredPermission("库存列表")
    public String list(Model model, @ModelAttribute("qo") ProductStockQueryObject qo) {
        model.addAttribute("depots", depotService.listAll());
        model.addAttribute("brands", brandService.listAll());
        model.addAttribute("pageResult", productStockService.query(qo));
        return "productStock/list";
    }


}
